package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/23
 */
public class Demo69 {
    public static void main(String[] args) {
        //计算1到n之间的数字的平方和，并输出其结果。
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字:");
        int num = sc.nextInt();
        int sum = 0;
        for (int i = 1; i <= num; i++) {
            sum += i;
        }
        System.out.println(1 + "-" + num + "之间的数字和为：" + sum);
    }
}
